﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bussiness;
using System.Data;

namespace EWebsite.Admin.Brokers {
    public partial class Default : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            if (!IsPostBack)
                _dataBind();
        }

        protected void btnUpdate_Click(object sender, EventArgs e) {
            BrokerBuss buss = new BrokerBuss();
            buss.update(txtName.Text, txtInfo.Text, txtWSName.Text, txtWSLink.Text, txtPvdID.Text, txtPwd.Text, txtCreditCardNumber.Text);

            _dataBind();
        }

        protected void _dataBind() {
            BrokerBuss buss = new BrokerBuss();
            DataTable table = buss.getBroker();
            if (table.Rows.Count > 0) {
                txtInfo.Text = table.Rows[0]["BrokerInfo"].ToString();
                txtName.Text = table.Rows[0]["BrokerName"].ToString();
                txtPvdID.Text = table.Rows[0]["PvdID"].ToString();
                txtPwd.Text = table.Rows[0]["PvdPwd"].ToString();
                txtWSLink.Text = table.Rows[0]["LinkWS"].ToString();
                txtWSName.Text = table.Rows[0]["WSName"].ToString();
                txtCreditCardNumber.Text = table.Rows[0]["PvdCreditCardNumber"].ToString();
                
            }
        }
    }
}